use std::path::PathBuf;

use clap::{command, Args, Parser, Subcommand, ValueEnum};

#[derive(Parser)]
#[command(version, about, long_about = None)]
pub struct CliArgs{
    /// The subcommand to run
    #[command(subcommand)]
    pub command:Command
}
#[derive(Subcommand,Clone)]
pub enum Command{
    /// Extract audio from video
    AudioConvert(AudioConvertArgs),
    /// Extract srt from audio
    SrtExtract(AudioExtractArgs),
    /// Translate srt
    SrtTranslate(SrtTranslateArgs),
    /// Merge video and srt
    MergeVideo,
    /// Do all the things, Extract udio, Extract srt, Translate srt, Merge video and srt
    ConvertAll(VideoSubtitleGeneratorArgs)
}
#[derive(Args,Clone)]
pub struct AudioConvertArgs{
    /// The path of the video file
    #[arg(short, long, value_name = "FILE")]
   pub video_file: PathBuf,
    /// The path of the output audio file, default is the same as the video file
    #[arg(short, long)]
    pub  output_file_name: Option<String>,
}
#[derive(Args,Clone)]
pub struct AudioExtractArgs{
    /// The path of the audio file
    #[arg(short,long,value_name="FILE")]
    pub audio_file:PathBuf,
    /// The path of the ouput srt file, default is the same as the audio file. extension is srt
    #[arg(short,long)]
    pub srt_file:Option<String>
}

#[derive(Args,Clone)]
pub struct SrtTranslateArgs{
    /// The path of the srt file
    #[arg(short,long,value_name="FILE")]
    pub srt_file:PathBuf,
    ///translate rule, default is TranslateDown
    #[arg(short,long,value_enum)]
    pub translate_rule:Option<TranslateRule>,
}

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum TranslateRule{
    TranslateOnly,
    TranslateUp,
    TranslateDown,
} 
#[derive(Args,Clone)]
pub struct VideoSubtitleGeneratorArgs{
    /// The path of the video file
    #[arg(short,long,value_name="FILE")]
    pub video_file:PathBuf,
  
    /// whether to keep the temporary files, default is false
    #[arg(short,long,default_value_t=false)]
    pub keep_tmpfiles:bool,
}